package sin;

import java.util.concurrent.Callable;

public class TasksDisturber {
	@SuppressWarnings("unchecked")
	public static Callable<Double>[] getTasks(int nThreads, int n) {
		Callable<Double>[] tasks = new Callable[nThreads];
		int forOne = (2*n+1)/nThreads;
		Countable sin = new MySin();
		for (int i=0; i<nThreads-1; i++) {
			tasks[i] = new CountPartOfSum(sin,-n+(i)*forOne,-n+(i+1)*forOne-1);
		}
		tasks[nThreads-1] = new CountPartOfSum(sin,-n+(nThreads-1)*forOne,n);
		return tasks;
	}
}
